pycharm use anaconda interpreter - python-2.7

I use anaconda's interpreter as pycharm interpreter. I wonder if all the module included in the "conda list" should appears in pycharm. In my situation, the anwser is NO, I need to install the modules which are already included in the "conda list"
Is it normal?

In the Settings -> Project Interpreter you can switch to the Conda Package Manager mode.
Also in the Project Interpreter drop-down menu above, make sure you are using the correct Conda Environment.

Related

Flask file does not work after deactivation and reactivated. "Flask can't be found"? [duplicate]

I just installed the new python3 module using terminal of Visual Studio Code on ubuntu.
When I import it, this error occurred.
[Python (analysis)] Unable to resolve 'new module'. IntelliSense may be missing for this module.
But the new module surely installed successfully. (I can import it in my ubuntu terminal)
How can I import that new python module in VS code?
You should look up the official docs on it. They have a neat tutorial to get you started.
Here are a few excerpts that should help you:
An "environment" in Python is the context in which a Python program runs. An environment consists of an interpreter and any number of installed packages. Because many programs are written specifically for a certain Python interpreter and makes use of a set of libraries, developers often create and manage an environment for individual programs.
When working with Python in VS Code, you select from available environments using the Python: Select Interpreter command. The Python extension then uses that selected environment for IntelliSense, auto-completions, linting, formatting, and any other language-related features. (The environment is not, however, used for debugging; see Choose a debugging environment.)
The selected environment is also automatically activated when using the Python: Run Python File in Terminal and Python: Create Terminal commands. Installing (or uninstalling) a package in the Terminal with a command like pip install matplotlib installs (or uninstalls) the package in whatever environment is active in that Terminal.
Note: By default, the Python extension looks for and uses on the first Python interpreter it finds in the system path. If it doesn't find an interpreter, it issues a warning. On macOS, the extension also issues a warning if you're using the OS-installed Python interpreter, because you typically want to use an interpreter you install directly. In either case, you can disable these warnings by setting python.disableInstallationCheck to true in your user settings.

multiple install of python, package install by pip are in wrong directory windows

I know this similar question has been answered before but I made the mistake of installing python 2.7 after a Anaconda installation. Now when I use the pip function in cmd, it install the package in the python 2.7 folder and not the Anaconda folder. using python -m pip function in cmd I get:
c:/python27/python .exe -m pip
I just want to use the Anaconda directory instead of this.. any easy way to specify it?
thank you..
You have to change your PATH environment variable so that the Python 2.7 directories are removed. The easiest way is to uninstall this extra Python version. If you would like to edit the PATH directly, see here: https://superuser.com/a/284351/229278
To quote the answer for Windows:
Windows
GUI
Open Control Panel » System » Advanced » Environment Variables.
Type control sysdm.cpl,,3 in the Run dialog (+R) and click Environment Variables.
For editing user variables you can also type
%windir%\System32\rundll32.exe sysdm.cpl,EditEnvironmentVariables
in the Run dialog.
Right-click (My) Computer and click on Properties, or simply press +Break.
In XP click on Advanced » Environment Variables.
In Vista+ click on Advanced system settings » Environment Variables.
There are many other ways of reaching the same place, such as by typing "environment variables" in the Start Menu/Screen search box and so on.
Environment variables in Windows are separated into user and machine/system specific values. You can view and edit their values there. Their current values upon launch are made available to all programs.
There is also Rapid Environment Editor, which helps setting and changing environment variables in Windows without the need to go deep into the system settings. Another open source program for Windows with which the path environment can be edited very conveniently is Path Editor.

How do I set Anaconda's python as my default python command?

I have both Anaconda and Python 2.7 installed on my Windows machine. Right now the command "python" points to Python 2.7, but I'd like instead for it to point to Anaconda's python. How do I set this up?
Your PATH is pointing to the original Python executable. You have to update your PATH.
(Assuming Windows 7)
Right-click on Computer, the Properties, the Advanced system settings, then click the Environment Variables... button.
The lower window has the system variables. Scroll down until you find Path, select it, and click edit. In the screen that appears, update the path that is pointing to your original python.exe to the one that is in the anaconda path.
Close any open command window for update to take effect.
From the docs (https://docs.anaconda.com/anaconda/user-guide/
source <path to conda>/bin/activate
conda init
"
Should I add Anaconda to the macOS or Linux PATH?
We do not recommend adding Anaconda to the PATH manually. During installation, you will be asked “Do you wish the installer to initialize Anaconda3 by running conda init?” We recommend “yes”. If you enter “no”, then conda will not modify your shell scripts at all. In order to initialize after the installation process is done, first run source /bin/activate and then run conda init.
"

Aptana Python stdlib issue with virtualenv

I recently started working on a project using just vim as my text editor with a virtualenv setup. I installed a few API's on this virtualenv from GitHub. Eventually, the project got a little bigger than vim could handle so I had to move the project to an IDE.
I chose Aptana Studio 3. When I started up Aptana, I pointed the project directory to the virtualenv folder that I had created to house my project. I then pointed the interpreter at the Python executable in App/bin (created from virtualenv)/python2.7. When I started reworking the code to make sure I had everything mapped correctly, I was able to import the API's that I had installed just fine. CherryPy came through with no problems, but I've been having an issue with importing a module that I believe is part of the stdlib--urlparse. At first, I thought it was that my python interpreter was 2.7.1 rather than 2.7.5 (I found the documentation in the 2.7.5 section with no option to review 2.7.1), but my terminal is using 2.7.1 and is able to import the module without any errors (I'm using OSX, Mountain Lion). I am also able to import the module when I activate the virtualenv and run my python interpreter. But when I plug "from urlparse import parse_qsl" into Aptana, I'm getting an error: "Unresolved_import: parse_qsl".
Should I have pointed this at a different interpreter and, if so, will I need to reinstall the API modules I had been working with in the new interpreter?
Update: I finally ended up restarting the project. It turns out that not all of the standard Python tools are selected when you select the virtualenv interpreter. After I selected all of the python tools from the list (just after choosing the interpreter), I was able to get access to the entire standard library.
Do NOT just import the modules into your project. Many of the stdlib modules are interdependent and the import function will only import a module into your main project directory, not a libary!

django in virtualenv with pydev

mac ox 8.2, eclipse juno, python 2.7, django 1.4.1, pydev 2.7.1.2012100913
I'm relative new with python/django and I'm trying to get it to work with pydev in a virtualenvironment. I set up the virtualenvironment installed django and successfully created and started a django project. After that I decided that I want to use my favorite editor eclipse.
I created a new pydev/django project, configured and selected a new interpreter (from virtualenv) and used that, I also included the virtualenv/lib/python2.7/site-packages/django in the interpreter libraries. However after going the next dialog, I got an error message "Django not found"
I went over the documentation but I haven't found any solution yet.
I was also wondering whether the workenvironment (or the actual code) needs to live in a subdirectory of the virtualenv directory) And whether the virtualenv must be activated (I suppose so), tried all these options but no luck yet.
As far as I'm aware you don't need the django installation (i.e., virtualenv/lib/python2.7/site-packages/django) in your interpreter libraries. Having the site-packages in there (i.e., virtualenv/lib/python2.7/site-packages) should suffice for your interpreter to find any django.* package.
putting this in your interpreter libraries:
virtualenv/lib/python2.7/site-packages/django
wiil not work, because there is no virtualenv/lib/python2.7/site-packages/django/django (yes, twice), this translates to the following:
export PYTHONPATH=<...virtualenv>/lib/python2.7/site-packages/django:$PYTHONPATH
python -c 'import django'
which fails with ImportError message. you need to give the parent directory.
virtualenv/lib/python2.7/site-packages
which translates to the following:
export PYTHONPATH=<...virtualenv>/lib/python2.7/site-packages:$PYTHONPATH
python -c 'import django'
.