Python 2.7.13 configured with `--enable-optimizations` puts many trash logs - python-2.7

when I open python console and close it by Ctrl + D,it comes with many logs.
why? how can I get rid of this.
$ /usr/local/bin/python
Python 2.7.13 (default, May 23 2017, 19:19:44)
[GCC 4.8.2 20140120 (Red Hat 4.8.2-15)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> // close with Ctrl + D
profiling:/root/Python-2.7.13:Cannot create directory
profiling:/root/Python-2.7.13/Objects/bytes_methods.gcda:Skip
profiling:/root/Python-2.7.13:Cannot create directory
profiling:/root/Python-2.7.13/Python/structmember.gcda:Skip
profiling:/root/Python-2.7.13:Cannot create directory
profiling:/root/Python-2.7.13/Python/getcopyright.gcda:Skip
...

This happened to me using Debian Stretch whilst installing Python 3.6.1. I initially installed it with, "sudo make altinstall" which caused those errors. However, if you install it as root rather than using sudo, the errors go away.
I answered this question a bit late but I hope it helps someone.

This happened to me when I did ./configure --enable-optimizations. Removing the --enable-optimizations flag before compilation and installation makes these messages go away.

Related

Is it possible to use gcc used to compile python in a virtual env?

I have a program to be compiled inside conda virtualenv where I need to have gcc.
However, when a python 2.7 being installed, it needs gcc to compile. So is it possible to use this gcc version to compile my program? or do I have to install gcc inside the env itself?
I have found out that ubuntu actually downloads pre-compile binaries to compile python.
According to Bodhi94: "Python shows you the compiler and version that was used to build python, it doesn't use this at runtime. The version of GCC used to build python doesn't matter itself."
Furthermore, gcc has already been installed in the system itself. I do not want the program to use this system gcc when it's compiling but to use the gcc version which is inside the enviornment. How do I actually test this? Thanks in advance!
(yourenvname) ~$python
Python 2.7.16 |Anaconda, Inc.| (default, Mar 14 2019, 21:00:58)
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.

Cannot run python 3.5 along with python 2.7.4 in Windows 10

I am trying to install Python 3.5.0 alongside with Python 2.7.4.
C:\Users\Animesh>python
Python 2.7.4 (default, Apr 6 2013, 19:55:15) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
C:\Users\Animesh>py
Python 2.7.4 (default, Apr 6 2013, 19:55:15) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
C:\Users\Animesh>py -2
Python 2.7.4 (default, Apr 6 2013, 19:55:15) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
C:\Users\Animesh>py -3
Fatal Python error: Py_Initialize: unable to load the file system codec
File "E:\Python27\Lib\encodings\__init__.py", line 123
raise CodecRegistryError,\
^
SyntaxError: invalid syntax
Current thread 0x00003514 (most recent call first):
I tried a bunch of commands as shown above but python 3.5 does not seem to work. I even tried creating a project on PyCharm using the Python 3.5 interpreter but it gives that same error.
How should I rectify this error?
The official installer for Python will install 3.5 in C:\Program Files\Python 3.5.
It will automatically add this path to your PATH variable (if you tell it). It seems like you did not enable this option.
In your PATH (not PYTHONPATH) setting.
You can get to this by going to the Settings application and searching for environment, then clicking on "Edit environment variables for your account" - this will open a properties window; click Environment Variables on the bottom to load the settings for your account.
You need to add the path manually to the PATH variable, and remove the E:\Python2.7 path.
Do this, then restart your command prompt and the default Python version will be 3.5.
For PyCharm, you can just add a new local interpreter in settings (CTRL+ALT+S) and point it directly to the location where you installed Python 3.5.
Since both interpreters are named python.exe, the first one found in your PATH will be executed. In practical terms this means, whatever is in your PATH is the default Python for your system. To execute the other version, you need to point to it explicitly.
If you have Python 2.7 in E:\Python2.7 and Python 3.5 in C:\Program Files\Python 3.5, pick the one you want to be the default and add the path to it in your PATH environment variable - you can always refer to the other installation by typing the full path to the python.exe file.
C:\>python.exe # this will launch whatever is found first in your `PATH`
C:\>E:\Python2.7\python.exe # explicitly launch the 2.7 version.
As far as PyCharm is concerned, it will read PATH and pick up the default interpreter, you can add the other one in your settings by browsing to its location.
Then, when creating a new project, you can pick which version you want to work with.

getting "SyntaxError" when installing twilio in the Windows command line interface

I'm new here and also a new Python learner. I was trying to install twilio package through the Windows command line interface, but I got a syntax error(please see below). I know there're related posts, however, I was still unable to make it work after trying those solutions. Perhaps I need to set the path in the command line, but I really have no idea how to do that...(I can see the easy_install and pip files in the Scripts folder under Python) Can anyone please help? Thanks in advance!
Microsoft Windows [Version 6.3.9600] (c) 2013 Microsoft Corporation.
All rights reserved.
C:\WINDOWS\system32>python Python 2.7.10 (default, May 23 2015,
09:44:00) [MSC v.1500 64 bit (AMD64)] on wi n32 Type "help",
"copyright", "credits" or "license" for more information.
easy_install twilio File "", line 1
easy_install twilio
^ SyntaxError: invalid syntax
You need to navigate to c:\python27\scripts and then run the command
easy_install twilio
this link helps too:
https://s3.amazonaws.com/udacity-hosted-downloads/ud036/How+to+install+Twilio+on+Windows.pdf
You should not type python first, then it becomes python command line.
Open a new command prompt and directly type:
easy_install twilio
go to the command prompt
it will say the account and all that jazz.
type cd ..
then hit enter
it will say C:\Users>
type cd .. again
then it will say C:>
type cd python27 (or the name of your python folder)
it will say C:\Python27>
type cd scripts
it will say C:\python27/scripts>
type easy_install twilio
then wait for it to run the procceses and then you will have twilio installed to python.

graph-tool import causing attempt to open socket?

I'm running graph-tool on Debian Jessie amd64. This server does not have X installed, nor do I wish to install it. Whenever I attempt to import * (per the quick start documentation), the following happens:
Python 2.7.9 (default, Mar 1 2015, 12:57:24)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from graph_tool.all import *
Unable to init server: Could not connect: Connection refused
Unable to init server: Could not connect: Connection refused
>>>
Attempting an strace on a test script is cumbersome, since there are a large number of libraries loaded when the above happens, but from spending a couple hours trawling through the output, I think it may be X or gdk-related. I'm hoping someone here knows what's causing this, and what I can do to prevent these seemingly cosmetic warnings from occurring, aside from redirecting STDERR to /dev/null.
Thanks.
This happens because it attempts to import Gtk, which tries to open an X11 connection.

Can't find django-admin.py in Lubuntu 12.10

I just installed Lubuntu 12.10 on a new laptop, and I'm trying to get Django working. I installed it from Synaptic Package Manager, and when I try to make a sample project on the command line, this is what I get:
amanda#amanda-ThinkPad-E420:~$ django-admin.py startproject caltrain
django-admin.py: command not found
And I verified Django is installed correctly,
amanda#amanda-ThinkPad-E420:~$ python
Python 2.7.3 (default, Sep 26 2012, 21:51:14)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> print(django.get_version())
1.4.1
>>>
Is this some sorta path issue or something? I don't remember having this issue on my Mac, but again I'm not very Unix savvy to begin with.
This information may be a bit stale, but I found this information that seems similar to your problem: http://ubuntuforums.org/showthread.php?t=1267372
With this solution:
Name of "django-admin.py" was changed to "django-admin" in /usr/bin directory in the python-django package.
To get around this I just created a symbolic link to django-admin named django-admin.py.
ln -s /usr/bin/django-admin /usr/bin/django-admin.py (as root)
Hope this helps, but again this was written in 2009.
You should see this. it contains details concerning problems with django-admin.py location
https://docs.djangoproject.com/en/1.6/faq/troubleshooting/#troubleshooting-django-admin-py